//
//  BiCarSaleParser.m
//  TrunkIndustryManageSystem
//
//  Created by 李璐西 on 15-4-6.
//  Copyright (c) 2015年 李璐西. All rights reserved.
//

#import "BiCarSaleParser.h"
#import "JSONKit.h"
#import "BiCarSaleCheckEntity.h"

@implementation BiCarSaleParser
SINGLE_INSTANCE_IMPLEMENTION(BiCarSaleParser)

+ (NSArray*)parserCarSaleCheckListEntity:(NSString*)jsonStr
{
    NSMutableArray * array = [NSMutableArray array];
    
    if ([jsonStr isKindOfClass:[NSString class]])
    {
//        将该json数据转化为OC对象
        NSArray *jsonArray = [jsonStr objectFromJSONStringWithParseOptions:JKParseOptionLooseUnicode];
        
        if (nil != jsonArray)
        {
            for (int i = 0; i < jsonArray.count; i++)
            {
                NSDictionary * dic = [jsonArray objectAtIndex:i];
                
                BiCarSaleCheckEntity * entity = [[BiCarSaleCheckEntity alloc] init];
                entity.name = [dic objectForKey:@"name"];
                entity.phone = [dic objectForKey:@"phone"];
                [array addObject:entity];
                [entity release];
            }
        }
        
        /*
        NSArray * carSaleCheckArr = [jsonDic objectForKey:@"ret"];
        
        if (nil != carSaleCheckArr)
        {
            for (int i = 0; i < carSaleCheckArr.count; i++)
            {
                NSDictionary * dic = [carSaleCheckArr objectAtIndex:i];
                
                BiCarSaleCheckEntity * entity = [[BiCarSaleCheckEntity alloc] init];
                entity.name = [dic objectForKey:@"name"];
                entity.phone = [dic objectForKey:@"phone"];
                [array addObject:entity];
                [entity release];
            }
        }
         */
    }
    
    return array;
}

@end
